import { defineStore } from 'pinia'
const jqInfo = {
  xh: 1,
  id: 'bc0d5bf60e4e4debbc4b75f73a27a48f',
  ajms: '公安转警:报警人称妹妹（18013897889）和他老公吵架在万达楼顶要跳楼',
  jd: 118.73071742,
  wd: 32.04166875,
  ajlxdm: '2',
  ajlx: '抢险',
  ajczztdm: '0',
  czdxdm: '111000',
  lasj: '2022-07-04 18:28:33',
  gdsj: null,
  spdzmc: '清江村站',
  zddwid: '4ffc633858df1ed3222bbcf39f37d482',
  xzqybh: '320105',
  tbdz: 'https://njxfxcx.nj119.com.cn:8081/gw/file-service/file/view//hg/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_202206241906041540290776968200192.png',
  xfjgPcInfo: null,
}
JSON.parse(localStorage.getItem('jqInfo') as string) || {}

export const useBusinessStore = defineStore({
  id: 'business',
  state: () => {
    return {
      refreshFlag: 0, // sockect
      addAlarmState: null, // socket 推送的新警情

      firstMarker: null,
      tabId: 0,
      currentTab: 'Company',
      currentTabName: '人员',
      StorageTankInfo: '', // 点击标牌内的tab数据
      StorageMxxxInfo: null, // 点击标牌内的tab数据
      transportCodeInfo: null, // 运单编号数据
      StorageTankInfoAttirbute: null, // 点击标牌内的tab数据
      currentID: 7, // tab选项卡最后一个按钮为动态组件
      zddwid: '', // 企业id
      jqId: '', // 警情id（案件id）
      jqInfo: jqInfo, // 警情info
      firstInfo: {}, // 第一个警情数据
      carXFCInfo: {}, // 小车的数据
      carWHPInfo: {}, // 小车的数据
      isBigLabel: true,

      showAlertInfo: {}, // 告警横幅显隐
    }
  },
  actions: {
    changeComponent(payload: any) {
      // this.jqInfo = payload
      localStorage.setItem('jqInfo', JSON.stringify(payload))
    },
    changeShowAlertState(payload: object) {
      this.showAlertInfo = payload
      setTimeout(() => {
        this.showAlertInfo = {}
      }, 60000)
    },
  },
  getters: {},
})
